package com.lz.convertor;

import com.lz.entity.OrderMaster;
import com.lz.entity.OrderMasterQuery;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 分页-订单实体类转订单查询类
 * Created by lz on 2018/8/21.
 */
public class OrderMaster2OrderMasterQueryConvertor {

    public static OrderMasterQuery convert(OrderMaster orderMaster){
        OrderMasterQuery orderMasterQuery = new OrderMasterQuery();
        BeanUtils.copyProperties(orderMaster,orderMasterQuery);
        return orderMasterQuery;
    }

    public static List<OrderMasterQuery> convert(List<OrderMaster> orderMasters){
        return orderMasters.stream().map(e ->
                convert(e)
        ).collect(Collectors.toList());
    }
}
